home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / INFO / DOS5BUG1.ZIP / BUGTEST.ASM next >
Assembly Source File  |  1991-07-01  |  3KB  |  104 lines

  1. PAGE    58,132
  2. TITLE    BUGTEST    6-23-91    [7-1-91]
  3. ;    Toad Hall disassembly and comment, 1 Jul 91
  4. ;    David Kirschbaum
  5. ;    kirsch@usasoc.soc.mil
  6.  
  7. LF    EQU    0AH
  8. CR    EQU    0DH
  9.  
  10. CSEG    SEGMENT
  11.     ASSUME DS:CSEG, SS:CSEG ,CS:CSEG ,ES:CSEG
  12.  
  13.     org    5CH
  14. drv1_05C    label    byte
  15.     org    6CH
  16. drv2_06C    label    byte
  17.  
  18.     ORG    100H
  19.  
  20. BugTest    proc    near
  21.     MOV    AL,drv1_05C    ;DS:5CH    PSP drive 1 char
  22.     MOV    AH,drv2_06C    ;DS:6CH PSP drive 2 char
  23.     MOV    BX,AX
  24.     ADD    AX,4040H    ;'@@' asciify
  25.     CMP    AL,'A'
  26.     JNB    Skp112
  27.      MOV    AL,'?'
  28. Skp112:    MOV    L072F,AL    ;stuff drive 1 char in text
  29.     CMP    AH,'A'
  30.     JNB    Skp11C
  31.      MOV    AH,'?'
  32. Skp11C:    MOV    L076B,AH    ;stuff drive 2 char in text
  33.     MOV    AL,BL        ;original drive 1 binary value
  34.     CALL    Hexify_139    ;hexify it
  35.     MOV    L074C,AX    ;stuff drive 1 hex value into text
  36.     MOV    AL,BH        ;original drive 2 binary value
  37.     CALL    Hexify_139    ;hexify it
  38.     MOV    L0788,AX    ;stuff drive 2 hex value into text
  39.  
  40.     MOV    AH,9
  41. ;v1.1    LEA    DX,L015A
  42.     mov    dx,offset L015A    ;text message to display
  43.     INT    21H
  44. ;ugh    RET_NEAR
  45.     mov    ax,4C00H    ;terminate properly        v1.1
  46.     int    21H        ;                v1.1
  47.  
  48. BugTest    ENDP
  49.  
  50.  
  51. Hexify_139    proc    near
  52.     MOV    AH,AL        ;into AH
  53.     AND    AH,0F0H        ;mask to hi bits
  54.     AND    AL,0FH        ;mask to lo bits
  55.     MOV    CL,4
  56.     SHR    AH,CL        ;shift hi bits right
  57.     ADD    AX,3030H    ;Asciify
  58.     CMP    AH,'9'
  59.     JBE    Skp14F
  60.      ADD    AH,7        ;hexify it
  61. Skp14F:    CMP    AL,'9'
  62.     JBE    Skp155
  63.     ADD    AL,7        ;hexify it
  64. Skp155:    XCHG    AH,AL        ;swap
  65.     RET
  66. Hexify_139    ENDP
  67.  
  68.  
  69. ;    DB    CR,LF
  70. L015A    label    byte
  71. DB 'DOS PROGRAMMERS, NOTE:  The purpose of this program is to demonstrate a bug I',CR,LF
  72. DB 'have noticed in the way MS-DOS Version 5.00 loads a program into an Upper',CR,LF
  73. DB 'Memory Block (UMB).  You may want to write a few extra lines of code to',CR,LF
  74. DB 'compensate for it.  Here is what happens:  When a user enters a DOS command',CR,LF
  75. DB 'followed immediately by filenames or drive letters in the format '
  76. db 22H,0EBH, ':filename',22H,CR,LF
  77. DB '(i.e. drive letter followed by a colon), DOS is supposed to encode each drive',CR,LF
  78. DB 'letter in the bytes at offsets 5Ch and 6Ch, respectively, in the program',CR,LF
  79. DB 'segment prefix (PSP) as the first byte of an unopened FCB.  An entry of "A:" is',CR,LF
  80. DB 'supposed to give you 01h, "B:" yields 02h, and so forth.  However, when MS-DOS',CR,LF
  81. DB 'Version 5.00 is running and your program has been loaded into a UMB using the',CR,LF
  82. DB 'LOADHIGH or LH command, DOS falls down.  The byte at 5Ch always remains a zero',CR,LF
  83. DB 'no matter what, and the byte at 6Ch is coded for the *first* drive specified!',CR,LF
  84. DB '(If you specify a second drive, it ends up who-knows-where.)  If you enter',CR,LF
  85. DB '"BUGTEST a: b:" under DOS Version 5.00, it will correctly return the specified',CR,LF
  86. DB 'drives.  But if you enter "LOADHIGH BUGTEST a: b:" instead, you',27H,'ll notice that',CR,LF
  87. DB 'DOS reports no first drive and the wrong second drive.  Probably nobody uses',CR,LF
  88. DB 'FCBs anymore, but those drive bytes come in very handy sometimes.  Grrrrr!',CR,LF
  89. DB CR,LF
  90. DB '                                           -- Jerry Monroe, CIS # 72321,1257',CR,LF
  91. DB '                                              June 23, 1991',CR,LF
  92. DB CR,LF
  93. DB 'First drive specified:   '
  94. L072F    DB    '   (byte at PSP offset 5Ch = '
  95. L074C    label    word
  96.     DB    '00h)',CR,LF
  97.     DB    'Second drive specified:  '
  98. L076B    DB    '   (byte at PSP offset 6Ch = '
  99. L0788    label    word
  100.     DB    '00h)',CR,LF,'$'
  101.  
  102. CSEG    ENDS
  103.     END    BugTest
  104.